require 'MVVM.Sources.View.Adaptor'
require "Common.UIDark"

DarkAdaptor = class('DarkAdaptor', Adaptor)

function DarkAdaptor:ctor(gameObject, propertyName, binder, func)
    self.component = gameObject
    self.func = func
    self:BindProperty(propertyName, binder)
end
function DarkAdaptor:OnViewModelValueChanged(oldValue, newValue)
    local component = GetBehaviour(self.component, UIDark.__cname)
    if self.func then
        component.enabled = self.func(newValue)
    else
        component.enabled = newValue
    end
end